﻿#ifndef PST_PSTINTERACTORSTYLE_H
#define PST_PSTINTERACTORSTYLE_H

#include <vtkSmartPointer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkCommand.h>
#include< vtkObjectFactory.h> 

namespace pst
{
    class TranslationInteractorStyle : public vtkInteractorStyleTrackballCamera
    {
    public:
        static TranslationInteractorStyle* New();
        vtkTypeMacro(TranslationInteractorStyle, vtkInteractorStyleTrackballCamera);

        virtual void OnLeftButtonDown()
        {
            this->OnMiddleButtonDown();
        }

        virtual void OnLeftButtonUp()
        {
            this->OnMiddleButtonUp();
        }

        //virtual void OnMouseMove()
        //{
        //    if (this->Interactor->GetControlKey()) // 如果需要其他按键组合，可以进行进一步判断
        //    {
        //        this->OnMiddleButtonDown(); // 将鼠标移动事件处理为中键移动
        //    }
        //    else
        //    {
        //        this->OnMiddleButtonMove(); // 直接平移
        //    }
        //}
    };

    vtkStandardNewMacro(TranslationInteractorStyle);


    class RotationInteractorStyle : public vtkInteractorStyleTrackballCamera
    {
    public:
        static RotationInteractorStyle* New();
        vtkTypeMacro(RotationInteractorStyle, vtkInteractorStyleTrackballCamera);

        //virtual void OnLeftButtonDown()
        //{
        //    this->OnMiddleButtonDown();
        //}

        //virtual void OnLeftButtonUp()
        //{
        //    this->OnMiddleButtonUp();
        //}

        virtual void OnLeftButtonDown() override
        {
            // 开始旋转
            this->StartRotate();
        }
        //virtual void OnMouseMove()
        //{
        //    if (this->Interactor->GetControlKey()) // 如果需要其他按键组合，可以进行进一步判断
        //    {
        //        this->OnMiddleButtonDown(); // 将鼠标移动事件处理为中键移动
        //    }
        //    else
        //    {
        //        this->OnMiddleButtonMove(); // 直接平移
        //    }
        //}
    };

    vtkStandardNewMacro(RotationInteractorStyle);
}


#endif
